package com.log4jviewer.logfile;

import junit.framework.Assert;

import org.junit.Test;

public class SpecialCharsConverterTest {

    @Test
    public void convertSpecialCharsTest() {
        Assert.assertEquals("\\\\a", SpecialCharsConverter.convertSpecialChars("\\a"));
        Assert.assertEquals("\\^\\$\\.\\-\\|\\(\\)\\[\\]\\{\\}\\?\\+\\*",
                SpecialCharsConverter.convertSpecialChars("^$.-|()[]{}?+*"));
        Assert.assertEquals("\\b", SpecialCharsConverter.convertSpecialChars("b"));
        Assert.assertEquals("\\f", SpecialCharsConverter.convertSpecialChars("f"));
        Assert.assertEquals("\\t\\n", SpecialCharsConverter.convertSpecialChars("\t\n"));
        Assert.assertEquals("[\\r]?", SpecialCharsConverter.convertSpecialChars("\r"));
        Assert.assertEquals("\\b", SpecialCharsConverter.convertSpecialChars("b"));
        Assert.assertEquals("a\\bcd", SpecialCharsConverter.convertSpecialChars("abcd"));
    }
}
